package com.example.learndevice.ui

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.CompoundButton
import com.example.learndevice.R
import com.example.learndevice.databinding.ActivityTurnViewBinding
import com.example.mydefinedview1.base.BaseActivity

class TurnViewActivity : BaseActivity<ActivityTurnViewBinding>(),CompoundButton.OnCheckedChangeListener {


    override fun ActivityTurnViewBinding.initBinding() {
        mBinding.ckControl.setOnCheckedChangeListener(this@TurnViewActivity)
    }

    override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
        if (buttonView?.id == R.id.ck_control){
            if (isChecked){
                mBinding.ckControl.text = "停止"
                mBinding.tvCircle.start()
            }else{
                mBinding.ckControl.text = "转动"
                mBinding.tvCircle.stop()
            }
        }
    }
}